package com.rran.study.designpattern.behavioral.observer.listener.simple;

import com.rran.study.designpattern.behavioral.observer.event.PlaceOrderEvent;
import com.rran.study.designpattern.behavioral.observer.model.OrderData;
import com.rran.study.designpattern.behavioral.observer.service.PlaceOrderObserver;

/**
 * @author yy
 * @Type SendMsgObserver.java
 * @Desc
 * @date 2020/7/21 17:44
 */
public class SendMsgObserver implements PlaceOrderObserver {
    @Override
    public void actionPlaceOrder(PlaceOrderEvent e) {
        this.sendMsg(e.getOrderData());
    }

    /**
     * 发送短信
     */
    private void sendMsg(OrderData orderData){
        System.out.println("发送短信成功，短信内容：");
        System.out.println("购买商品数为：" + orderData.getMoney());
        System.out.println("总共消费了：" + orderData.getBuyCount());
    }
}
